package com.zhiwang.planet.ui.my.message

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.zhiwang.planet.R
import com.zhiwang.planet.databinding.FragmentFeedbackDetailBinding
import com.zhiwang.planet.mvvm.model.entity.main.FeedBack
import com.zhiwang.planet.ui.BaseFragment
import kotlinx.android.synthetic.main.fragment_feedback_detail.*

class FeedBackDetailFragment : BaseFragment() {

    companion object {
        fun newInstance(feedback: FeedBack): FeedBackDetailFragment {
            val args = Bundle()

            val fragment = FeedBackDetailFragment()
            fragment.arguments = args.apply { putParcelable("data", feedback) }
            return fragment
        }
    }


    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val root = inflater.inflate(R.layout.fragment_feedback_detail, container, false)

        val binding = DataBindingUtil.bind<FragmentFeedbackDetailBinding>(root)
        binding?.lifecycleOwner = viewLifecycleOwner
        binding?.viewModel = arguments?.getParcelable("data")
        return root
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        toolbar?.title = "反馈详情"
        (requireActivity() as AppCompatActivity).setSupportActionBar(toolbar)
    }
}